import request from "../../http";

export function fetchArticle(query) {
  return request({
    url: "/api/article/list",
    method: "get",
    params: query
  });
}

export function getOneArticle(id) {
  return request({
    url: "/api/article/" + id,
    method: "get"
  });
}

export function saveArticle(paramer) {
  return request({
    url: "/api/article",
    method: "POST",
    data: paramer
  });
}

export function deleteArticle(paramer) {
  return request({
    url: "/api/article/" + paramer.id,
    method: "delete",
    data: paramer
  });
}

// 批量发布
export function release(paramer) {
  return request({
    url: "/api/article/release",
    method: "POST",
    data: paramer
  });
}

// 批量删除

export function batchDelete(paramer) {
  return request({
    url: "api/article",
    method: "DELETE",
    data: paramer
  });
}

// 具体类别下所有文章
export function secondList(query) {
  return request({
    url: "/api/article/list/" + query.id,
    method: "get",
    params: query
  });
}

export function getAllsecondList(query) {
  return request({
    url: "/api/category/article/secondList",
    method: "get",
    params: query
  });
}
